package cn.car.service.impl;

import cn.car.domains.entity.VehicleCommonLedgerInfoEntity;
import cn.car.mapper.VehicleCommonLedgerInfoMapper;
import cn.car.service.VehicleCommonLedgerInfoService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class VehicleCommonLedgerInfoServiceImpl implements VehicleCommonLedgerInfoService {

    @Resource
    private VehicleCommonLedgerInfoMapper vehicleCommonLedgerInfoMapper;

    @Override
    public void insert(VehicleCommonLedgerInfoEntity ledgerInfoEntity) {
        vehicleCommonLedgerInfoMapper.insert(ledgerInfoEntity);
    }

    @Override
    public void updateAssociationId(Long id, Long associationId) {
        VehicleCommonLedgerInfoEntity updateEntity = new VehicleCommonLedgerInfoEntity();
        updateEntity.setId(id);
        updateEntity.setAssociationId(associationId);
        vehicleCommonLedgerInfoMapper.update(updateEntity);
    }

    @Override
    public VehicleCommonLedgerInfoEntity getLastLedgerByVehicleNumber(String vehicleNumber) {
        return vehicleCommonLedgerInfoMapper.getLastLedgerByVehicleNumber(vehicleNumber);
    }

    @Override
    public void update(VehicleCommonLedgerInfoEntity ledgerInfoEntity) {
        vehicleCommonLedgerInfoMapper.update(ledgerInfoEntity);
    }
}
